package org.wevil.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 图标工具类
 *
 * @author wanglei
 * @since 2021/4/9
 */
public class ChartUtil {

    /**
     * 集合转数组
     *
     * @author wanglei
     * @since 2021/4/9
     */
    public static Map<String, String[]> dto2Vo(List<Object[]> lineChartDtoList) {
        Map<String, String[]> map = new HashMap<>();
        String[] xArray = new String[lineChartDtoList.size()];
        String[] yArray = new String[lineChartDtoList.size()];
        int index = 0;
        for(Object[] objects : lineChartDtoList){
            String x = (String) objects[0];
            String y = objects[1].toString().equals("0E-7") ? "0" : objects[1].toString();
            xArray[index] = x;
            yArray[index] = y;
            index++;
        }
        map.put("x", xArray);
        map.put("y", yArray);
        return map;
    }
}
